#include "cstring"
#include "iostream"
#include "string"

using namespace std;

int main()
{
    int T;
    cin >> T;
    while (T--)
    {
        int n;
        cin >> n;
        int count[10] = {0};
        int k;
        for(k = 1; k <= n; k++)
        {
            string s = to_string(k);
            int l = s.length();
            for (int i = 0; i < l; i++)
            {
                count[s[i] - '0']++;
            }
        }

        for(int i = 0; i < 10; i++)
        {
            cout << count[i];
            if(i == 9) cout << endl;
            else cout << ' ';
        }
    }
    return 0;
}